# Contributor: Carlo Landmeter <clandmeter@alpinelinux.org>
# Maintainer: Francesco Colista <fcolista@alpinelinux.org>
pkgname=cgmanager
pkgver=0.42
pkgrel=7
pkgdesc="Another daemon for managing control groups"
url="https://linuxcontainers.org/cgmanager/"
arch="all"
license="LGPL-2.0-or-later"
depends_dev="linux-pam-dev"
makedepends="$depends_dev linux-headers libnih-dev popt-dev"
subpackages="$pkgname-dev $pkgname-openrc"
source="https://linuxcontainers.org/downloads/cgmanager/cgmanager-$pkgver.tar.gz
	cgmanager.initd
	cgproxy.initd"

prepare(){
	default_prepare
	update_config_sub
}

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		--localstatedir=/var \
		--with-distro=gentoo \
		--disable-static
	make
}

check() {
	make check
}

package() {
	make DESTDIR="$pkgdir" install
	install -Dm755 "$srcdir"/cgmanager.initd "$pkgdir"/etc/init.d/cgmanager
	install -Dm755 "$srcdir"/cgproxy.initd "$pkgdir"/etc/init.d/cgproxy
}

sha512sums="d92113a6748084f1c0708f75c8bdf5de484d534bf00f664a5288902be887c2a1c7cf3d91afaab3331f0d573a86fbc6edb2fa1d37c070250cf53e0621213d7d74  cgmanager-0.42.tar.gz
127a530a213a715e42a288e808d85c561a467071e5a147057475ff5a1bf8a67ba7d6ca1777f8557420d5ce577df429857e6f5a2d942724f5a8d5a21243e41e7b  cgmanager.initd
f3a50bce3d4cfaca0b37717b12bace86a46de589cb23a7c689dd6eb9fb5579bccbd35664c9beab6bcfbdbd658999f33fb5052721d2f40a6e64e2f65e8eccfe7a  cgproxy.initd"
